package com.wchen.common.page;

/**
 * 分页参数包装器
 *
 * @author  wchen
 * @date    2019/11/12
 */
public class PageQueryWrapper<TQuery> {

    private Class<TQuery> queryClazz;

    public PageQueryWrapper() {
        this.page = new Page();
    }

    private TQuery queryBody;
    private Page page;

    public TQuery getDefaultQueryBody() {
        if (queryClazz == null) {
            return null;
        }
        TQuery query = null;
        try {
            query = queryClazz.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        return query;
    }

    public Class<TQuery> getQueryClazz() {
        return queryClazz;
    }

    public void setQueryClazz(Class<TQuery> queryClazz) {
        this.queryClazz = queryClazz;
    }

    public TQuery getQueryBody() {
        return queryBody;
    }

    public void setQueryBody(TQuery queryBody) {
        this.queryBody = queryBody;
    }

    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }
}
